# 构建阶段
FROM python:3.12-alpine AS builder

# 创建安全用户
#RUN addgroup -S security && adduser -S security -G security
#USER security

WORKDIR /usr/src/app

COPY . .

RUN pip install --no-cache-dir -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple

# 运行阶段
FROM python:3.12-alpine

WORKDIR /usr/src/app

COPY --from=builder /usr/local/lib/python3.12/site-packages /usr/local/lib/python3.12/site-packages
COPY --from=builder /usr/src/app .

ARG VERSION
LABEL version=${VERSION}
CMD ["python", "./src/main.py", "schedule"]
